//
//  MessageHomeViewController.m
//  OtherDemo
//
//  Created by lianjie on 2018/7/23.
//  Copyright © 2018年 lianjie. All rights reserved.
//

#import "MessageHomeViewController.h"
#import "JJHeaders.h"

@interface MessageHomeViewController ()

@end

@implementation MessageHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"消息";
    
//    [self loadData];
    
    [self createView];
    
}

#pragma mark ----RequestData
-(void)loadData
{
    NSMutableArray *arr = [NSMutableArray array];
    
    NSArray *urlArr = @[@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1532927874287&di=65021b2d949d198375e75c4e59e0891d&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimgad%2Fpic%2Fitem%2Fd52a2834349b033bf08869fe1fce36d3d539bd96.jpg"];
    /*
     ,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1532927913300&di=14b604f10c32cd7926caa16ec6440494&imgtype=0&src=http%3A%2F%2Fimage.bitauto.com%2Fdealer%2Fnews%2F100124452%2Fd208b7f2-2e28-4366-8e26-5a8b19209d00.jpg",@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1532927927672&di=a9a0b052ca863f07ae4c723f3a52cd0f&imgtype=0&src=http%3A%2F%2Fpic6.nipic.com%2F20100315%2F218586_005636791281_2.jpg"*/
    
    for (int i = 0; i<urlArr.count; i++) {
        NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlArr[i]]];
        UIImage *image = [UIImage imageWithData:data];
        [arr addObject:image];
    }
    UIView *bgview = [JJHeaders createHeaderView:80 images:arr];
    bgview.backgroundColor = [UIColor redColor];
    bgview.x = 100;
    bgview.y = 300;
    [self.view addSubview:bgview];
    
}


#pragma mark ----initView
-(void)createView
{
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [btn addTarget:self action:@selector(joinMessage) forControlEvents:UIControlEventTouchUpInside];
    
    btn.frame = CGRectMake(100, 100, 100, 40);
    
    [btn setTitle:@"消息" forState:UIControlStateNormal];
    
    
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    
    [self.view addSubview:btn];
    
}

- (void)joinMessage
{
    
    
    BaseViewController *vc = [[NSClassFromString(@"DEWMessageHomeController") alloc]init];
    
    [self.navigationController pushViewController:vc animated:YES];
    
    
    
}

/**
 
 NSMutableDictionary *paramDic = [NSMutableDictionary dictionary];
 DELoginModel *model = [HHUserManager getUserInfo];
 
 paramDic[@"userId"] = model.userId;
 paramDic[@"tokenId"] = model.tokenId;
 
 
 NSMutableArray *qualifiMarray = [NSMutableArray arrayWithCapacity:0];
 for (int i = 0; i < self.imageMArray.count; i++) {
 NSData *imageData;
 if ([self.imageMArray[i] class] == [UIImage class]) {
 imageData = UIImageJPEGRepresentation(self.imageMArray[i], 1.0);
 }else{
 imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString appendImageString:self.imageMArray[i]]]];
 }
 NSString *pictureStr = [imageData base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
 
 NSDictionary *dict = @{@"imagetype":@"png",@"image":pictureStr};
 [qualifiMarray addObject:dict];
 }
 NSString *pictureStr = [StringHelper jsonStringFromObject:qualifiMarray];
 paramDic[@"picUriList"] = pictureStr;
 
 [MBProgressHUD showMessage:@"正在上传单据图片..."];
 [KSHTTPSTool post:[KSService urlSetAttestImage] params:paramDic formData:nil progress:^(NSProgress *downloadProgress) {
 } success:^(id responseObject) {
 [MBProgressHUD hideHUD];
 if (DERetCode) {
 DELAuthenticationCompleteViewController *completeVC = [[DELAuthenticationCompleteViewController alloc] init];
 completeVC.imgeUrlString = responseObject[@"data"][@"imgeUrl"];
 [self.navigationController pushViewController:completeVC animated:YES];
 }else{
 [[AlertHelper sharedManager] alertWithMessage:responseObject[@"retMsg"]];
 }
 } failure:^(NSError *error) {
 [MBProgressHUD hideHUD];
 }];
 
 */


#pragma mark ---lazy
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
